package service

import (
	"goadmin/internal/model"
	"gorm.io/gorm"
)

type UserService struct {
	db *gorm.DB
}

func (service *UserService) AddUser(u *model.User) {
	service.db.Save(u)
}

func (service *UserService) EditUser(u *model.User) {
	service.db.Updates(u)
}

func (service *UserService) FindById(id uint) (r *model.User) {
	service.db.Model(&model.User{}).First(r, id)
	return
}
